﻿using System;
using NCommet.Core;
using NCommet.Core.Agents;

namespace NCommet.Modules.Authorization
{
    /// <summary>
    /// An abstract base for authorization managers that do not support changing access levels.
    /// You can derive your implementation from this class when your roles' access levels are fixed.
    /// </summary>
    public abstract class ReadOnlyAuthorizationManagerBase : AuthorizationManagerBase
    {
        /// <summary>
        /// Returns <c>true</c>, implying that all access levels are explicitly set on each item for every role.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        public override bool IsAccessLevelSet(Item item, string role)
        {
            return true;
        }

        /// <summary>
        /// An empty method implementation, ignoring requests to change access levels.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="role"></param>
        /// <param name="accessLevel"></param>
        public override void SetAccessLevel(Item item, string role, AccessLevel accessLevel)
        {

        }

        /// <summary>
        /// An empty method implementation, ignoring requests to reset access levels.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="role"></param>
        public override void ResetAccessLevel(Item item, string role)
        {

        }

        /// <summary>
        /// An empty method implementation, ignoring the fact that some roles where deleted.
        /// </summary>
        /// <param name="roles"></param>
        public override void RolesDeleted(string[] roles)
        {

        }
    }
}
